package com.ceba.test.base.dbdata.modules;
import com.ceba.base.dbdata.DataTableObject;
import com.ceba.base.dbdata.MysqlUtils;
public class StatisticDb {

	public static void init() throws Exception{
		
		//6-start
		DataTableObject cb_report_attach=new DataTableObject("cb_report_attach");
		cb_report_attach.addField("ID", "varchar(32)", "NOT NULL", "", "true");
		cb_report_attach.addField("REPORT_ID", "varchar(32)", "NOT NULL", "", "false");
		cb_report_attach.addField("G_FILE_ID", "varchar(32)", "NOT NULL", "", "false");
		cb_report_attach.addField("HAS_SIGN", "int(4)", "DEFAULT NULL", "", "false");
		cb_report_attach.addField("SIGN_TIME", "datetime", "DEFAULT NULL", "", "false");
		cb_report_attach.addField("CREATE_USER", "varchar(64)", "DEFAULT NULL", "", "false");
		cb_report_attach.addField("CREATE_TIME", "datetime", "DEFAULT NULL", "", "false");
		
		MysqlUtils.syncTableStructure(cb_report_attach);
		//end
		
		//7-start
		DataTableObject cb_report_sign=new DataTableObject("cb_report_sign");
		cb_report_sign.addField("ID", "varchar(32)", "NOT NULL", "", "true");
		cb_report_sign.addField("FILE_ID", "varchar(32)", "DEFAULT NULL", "", "false");
		cb_report_sign.addField("CREATE_USER_IP", "varchar(32)", "DEFAULT NULL", "签名人IP  API版", "false");
		cb_report_sign.addField("FILE_NAME", "varchar(500)", "DEFAULT NULL", "原始文件名称", "false");
		cb_report_sign.addField("CREATE_USER_NAME", "varchar(500)", "DEFAULT NULL", "签名人", "false");
		cb_report_sign.addField("EDITION_TYPE", "int", "DEFAULT 3", "操作版本", "false");
		cb_report_sign.addField("FILE_TYPE", "int", "DEFAULT 1", "文件类型 1 报告  2 附件", "false");
		cb_report_sign.addField("CREATE_USER", "varchar(64)", "DEFAULT NULL", "", "false");
		cb_report_sign.addField("CREATE_TIME", "datetime", "DEFAULT NULL", "", "false");
		
		MysqlUtils.syncTableStructure(cb_report_sign);
		//end
				
		//8-start
		DataTableObject collectsign_report_attach=new DataTableObject("collectsign_report_attach");
		collectsign_report_attach.addField("ID", "varchar(32)", "NOT NULL", "", "true");
		collectsign_report_attach.addField("SUM_DATE", "datetime", "DEFAULT NULL", "", "false");
		collectsign_report_attach.addField("S_COUNT", "float", "DEFAULT NULL", "", "false");
		collectsign_report_attach.addField("CREATE_USER", "varchar(32)", "DEFAULT NULL", "", "false");
		collectsign_report_attach.addField("CREATE_TIME", "datetime", "DEFAULT NULL", "", "false");
		MysqlUtils.syncTableStructure(collectsign_report_attach);
		//end
		
		addIndex();
	}
	
	public static void addIndex() throws Exception {
		MysqlUtils.syncFieldIndex("cb_report_attach", "REPORT_ID");
		MysqlUtils.syncFieldIndex("cb_report_sign", "REPORT_ID");
	}
}
